package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Conf struct {
	Mysql
}
type Mysql struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}

var AppConfig Conf

func Init() {
	viper.SetConfigFile("./appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("配置文件失败")
	}
	err = viper.Unmarshal(&AppConfig)
	if err != nil {
		fmt.Println("配置文件读取失败")
	}
}
